﻿<UserControl x:Class="Wpfконфигуратор.Редактор"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:this="clr-namespace:Wpfконфигуратор" 
             xmlns:Wpfконфигуратор="clr-namespace:Wpfконфигуратор" 
             xmlns:my="http://schemas.microsoft.com/winfx/2006/xaml/presentation/ribbon" 
              mc:Ignorable="d" 
             d:DesignHeight="536" d:DesignWidth="704" Margin="0">
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="СловарьРедакторовЗначений.xaml" />
            </ResourceDictionary.MergedDictionaries>

            <Style x:Key="ListBoxItemBack">
                <Style.Triggers>
                    <DataTrigger Binding = "{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type ListBoxItem}}, Path=IsSelected}"
                                                                         Value="True">
                        <Setter Property="ListBoxItem.Background" Value="AliceBlue"/>
                        <Setter Property="ListBoxItem.Foreground" Value="Black"/>
                    </DataTrigger>
                </Style.Triggers>
            </Style>
            <LinearGradientBrush x:Key="FocusedBackground1" EndPoint="0,1">
                <GradientStop Color="#FFFEFBF4" Offset="0" />
                <GradientStop Color="#FFFDE7CE" Offset="0.19" />
                <GradientStop Color="#FFFDDEB8" Offset="0.39" />
                <GradientStop Color="#FFFFCE6B" Offset="0.39" />
                <GradientStop Color="#FFFFDE9A" Offset="0.79" />
                <GradientStop Color="#FFFFEBAA" Offset="1" />
            </LinearGradientBrush>
            <Style x:Key="СтильКнопки" TargetType="{x:Type MenuItem}" >
                <Setter Property="BorderBrush" Value="Silver"/>
                <Style.Triggers>
                    <Trigger  Property="IsMouseOver"  Value="True">
                        <Setter Property="Background" Value="{StaticResource FocusedBackground1}"/>
                        <Setter Property="BorderBrush" Value="#FFFFB700"/>
                    </Trigger>
                </Style.Triggers>
            </Style>
        </ResourceDictionary>
    </UserControl.Resources>
    <Grid Name="gridРедактор"  Grid.Column="2">
        <Grid.RowDefinitions>
            <RowDefinition Height="40"></RowDefinition>
            <RowDefinition></RowDefinition>
        </Grid.RowDefinitions>
        <Grid.Children>

            <Grid Grid.Row="0">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                    <ColumnDefinition></ColumnDefinition>
                </Grid.ColumnDefinitions>
                <Grid.Children>
                    <Button Grid.Column="0" Name="кнопкаНазад"  VerticalAlignment="Center"  Padding="5"
                                Margin="7,0,0,0" 
                                Click="кнопкаНазад_Click" HorizontalAlignment="Center" >
                        <Button.Content>
                            <Image Source="/Wpfконфигуратор;component/Images/112_LeftArrowShort_Grey_24x24_72.png" />
                        </Button.Content>
                    </Button>
                    <Button Grid.Column="1" Name="кнопкаВперед"  VerticalAlignment="Center"  
                                 Margin="5,0,0,0"
                                 Padding="5" Click="кнопкаВперед_Click" HorizontalAlignment="Center" >
                    <Button.Content>
                        <Image Source="/Wpfконфигуратор;component/Images/112_RightArrowShort_Grey_24x24_72.png" />
                    </Button.Content>
                    </Button>
                    <TextBlock Grid.Column="2" Name="textBlockИсторияПросмотра"  VerticalAlignment="Center" 
                                   Margin="5,0,7,0"
                                   Text="{Binding Path=Тип.Name}" Padding="5" Background="White"/>
                </Grid.Children>

            </Grid>

            <TabControl Name="tabControlРедактор" Grid.Row="1"   Margin="0,0,0,0" TabStripPlacement="Left">
                <TabItem Header="Тип">
                    <TabControl Name="tabControl2">
                        <TabItem Header="Определение" Name="tabItemОбщие1" IsEnabled="True">
                            <Grid DataContext="{Binding Path=ОписаниеТипа}" Margin="5">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto" />
                                    <ColumnDefinition />
                                </Grid.ColumnDefinitions>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto" />
                                    <RowDefinition Height="Auto" />
                                    <RowDefinition Height="Auto" />
                                    <RowDefinition Height="Auto" />
                                    <RowDefinition Height="Auto" />
                                    <RowDefinition Height="Auto" />
                                    <RowDefinition />
                                </Grid.RowDefinitions>
                                <TextBlock  HorizontalAlignment="Left" 
                                   Margin="5" Name="textBlock1" Text="{Binding Path=Описание}" 
                                   VerticalAlignment="Top" MinWidth="634" TextWrapping="Wrap" Grid.Row="5" Grid.Column="1" />
                                <TextBlock  HorizontalAlignment="Left" Margin="5" Name="textBlock2"
                                   Text="{Binding Path=Тип.Namespace}" VerticalAlignment="Top" MinWidth="334" Grid.Row="2" Grid.Column="1" />
                                <TextBlock  HorizontalAlignment="Left"  Name="textBlock3" MinWidth="100"
                                   Text="{Binding Path=Тип.Assembly}" VerticalAlignment="Top" Grid.Row="3" Margin="5" Grid.Column="1" />

                                <Expander Grid.Row="6" HorizontalAlignment="Left" Margin="5" 
                                  Name="expander1" VerticalAlignment="Top" IsExpanded="True" 
                                  ExpandDirection="Right" HorizontalContentAlignment="Center" BorderThickness="0" Grid.Column="1">

                                    <DataGrid AutoGenerateColumns="False"  HorizontalAlignment="Left" 
                                   Name="dataGrid2" VerticalAlignment="Top"
                                  ItemsSource ="{Binding Path=Предки}" IsReadOnly="True" CanUserSortColumns="False" CanUserResizeColumns="False" BorderThickness="1" GridLinesVisibility="None" EnableRowVirtualization="False" HeadersVisibility="Column">
                                        <DataGrid.Columns>
                                            <DataGridTextColumn Header="Имя" Binding="{Binding Path=Name}" />
                                            <DataGridTextColumn Header="Префикс" Binding="{Binding Path=Namespace}"/>
                                        </DataGrid.Columns>
                                    </DataGrid>
                                </Expander>
                                <TextBlock  HorizontalAlignment="Right" Margin="5" Name="textBlock4" Text="Префикс :" VerticalAlignment="Top" Grid.Row="2" Foreground="Silver" />
                                <TextBlock  HorizontalAlignment="Right" Margin="5" Name="textBlock5" Text="Сборка :" VerticalAlignment="Top" FontWeight="Normal" Foreground="Silver" Grid.Row="3" />
                                <TextBlock  HorizontalAlignment="Right" Margin="5" Name="textBlock6" Text="Синтаксис :" VerticalAlignment="Top" Grid.Row="5" Foreground="Silver" />
                                <TextBlock  HorizontalAlignment="Right" Margin="5" Name="textBlock7" Text="Предки :" VerticalAlignment="Top" Grid.Row="6" Foreground="Silver" />
                                <TextBlock FontWeight="Normal" Foreground="Silver"  HorizontalAlignment="Right" Margin="5" Name="textBlock8" Text="Имя :" VerticalAlignment="Bottom" TextAlignment="Left" />
                                <TextBlock  HorizontalAlignment="Left" Margin="5" MinWidth="100" Name="textBlock9" Text="{Binding Path=Имя}" VerticalAlignment="Bottom" Grid.Column="1" FontSize="18" FontWeight="Bold" Foreground="DarkBlue" />
                                <TextBlock Foreground="Silver" HorizontalAlignment="Right" Margin="5" Name="textBlock10" Text="Тип :" VerticalAlignment="Bottom" Grid.Row="1" />
                                <TextBlock HorizontalAlignment="Left" Margin="5" MinWidth="100" Name="textBlock12" Text="{Binding Path=ТипСАтрибутомПереопределения}" VerticalAlignment="Bottom" Grid.Column="1" Grid.Row="1" />
                            </Grid>

                        </TabItem>
                        <TabItem Header="Конструкторы">
                            <Grid>
                                <Grid.RowDefinitions>
                                    <RowDefinition />
                                    <RowDefinition Height="Auto" />
                                    
                                </Grid.RowDefinitions>
                                <DataGrid AutoGenerateColumns="False" Grid.Row="0"  HorizontalAlignment="Left" Name="dataGridКонструкторы"
                                          VerticalAlignment="Top" HorizontalContentAlignment="Stretch" 
                                          VerticalContentAlignment="Stretch" ItemsSource="{Binding Path=Конструкторы}" >
                                    <DataGrid.Columns>
                                        <DataGridTextColumn Header="Доступ" Binding="{Binding Path=АтрибутыДоступа}" />
                                        <DataGridTextColumn Header="Имя" Binding="{Binding Path=КонструкторИнфо.Name}" />
                                        <DataGridTextColumn Header="Параметры" Binding="{Binding Path=СинтаксисПараметров}" />
                                    </DataGrid.Columns>
                                </DataGrid>
                                <Grid Grid.Row="1">
                                    
                                </Grid>
                            </Grid>
                            <!--<ListBox Name="listBoxКонструкторы" Grid.Row="1" ItemsSource="{Binding Path=Конструкторы}"></ListBox>-->
                        </TabItem>
                        <TabItem Header="Поля" Name="tabItemПоляТипа">
                            <ListBox Margin="2" Name="СписокПолейТипа" ItemsSource="{Binding Path=ПоляТипа}" MouseDoubleClick="СписокПолей_MouseDoubleClick">
                                <ListBox.Resources>
                                    <DataTemplate x:Key="Перечисление">
                                        <StackPanel Orientation="Horizontal">
                                            <!--<TextBlock Text="{Binding Path=F.FieldType.Name}" Margin=" 0,0,5,0" />-->
                                            <TextBlock Text="{Binding Path= АтрибутыДоступа}" Foreground="Blue" Margin=" 0,0,5,0" />
                                            <TextBlock Text="static" Foreground="Blue" Margin=" 0,0,5,0">
                                        <TextBlock.Style>
                                            <Style> 
                                                <Style.Triggers>
                                                    <DataTrigger Binding="{Binding Path=F.IsStatic}" Value="False">
                                                            <Setter Property="TextBlock.Visibility" Value="Collapsed" />
                                                    </DataTrigger>
                                                </Style.Triggers>
                                            </Style>
                                        </TextBlock.Style></TextBlock>
                                            <TextBlock Text="const" Foreground="Blue" Margin=" 0,0,5,0">
                                        <TextBlock.Style>
                                            <Style> 
                                                <Style.Triggers>
                                                    <DataTrigger Binding="{Binding Path=F.IsLiteral}" Value="False">
                                                            <Setter Property="TextBlock.Visibility" Value="Collapsed" />
                                                    </DataTrigger>
                                                </Style.Triggers>
                                            </Style>
                                        </TextBlock.Style></TextBlock>
                                            <TextBlock Text="readonly" Foreground="Blue" Margin=" 0,0,5,0">
                                        <TextBlock.Style>
                                            <Style> 
                                                <Style.Triggers>
                                                    <DataTrigger Binding="{Binding Path=F.IsInitOnly}" Value="False">
                                                            <Setter Property="TextBlock.Visibility" Value="Collapsed" />
                                                    </DataTrigger>
                                                </Style.Triggers>
                                            </Style>
                                        </TextBlock.Style></TextBlock>
                                            <TextBlock Text="{Binding Path= F.DeclaringType.Name}" Margin=" 0,0,0,0" />
                                            <TextBlock Text="." />
                                            <TextBlock Text="{Binding Path=F.Name}" Margin=" 0,0,5,0" />
                                            <ComboBox ItemsSource="{Binding Path=СписокПеречислителя}" DisplayMemberPath="F.Name" />
                                        </StackPanel>
                                    </DataTemplate>
                                    <DataTemplate x:Key="Стандартная">
                                        <StackPanel Orientation="Horizontal">
                                            <!--<TextBlock Text="{Binding Path=F.FieldType.Name}" Margin=" 0,0,5,0" />-->
                                            <TextBlock Text="{Binding Path= АтрибутыДоступа}" Foreground="Blue" Margin=" 0,0,5,0" />
                                            <TextBlock Text="static" Foreground="Blue" Margin=" 0,0,5,0">
                                        <TextBlock.Style>
                                            <Style> 
                                                <Style.Triggers>
                                                    <DataTrigger Binding="{Binding Path=F.IsStatic}" Value="False">
                                                            <Setter Property="TextBlock.Visibility" Value="Collapsed" />
                                                    </DataTrigger>
                                                </Style.Triggers>
                                            </Style>
                                        </TextBlock.Style></TextBlock>
                                            <TextBlock Text="const" Foreground="Blue" Margin=" 0,0,5,0">
                                        <TextBlock.Style>
                                            <Style> 
                                                <Style.Triggers>
                                                    <DataTrigger Binding="{Binding Path=F.IsLiteral}" Value="False">
                                                            <Setter Property="TextBlock.Visibility" Value="Collapsed" />
                                                    </DataTrigger>
                                                </Style.Triggers>
                                            </Style>
                                        </TextBlock.Style></TextBlock>
                                            <TextBlock Text="readonly" Foreground="Blue" Margin=" 0,0,5,0">
                                        <TextBlock.Style>
                                            <Style> 
                                                <Style.Triggers>
                                                    <DataTrigger Binding="{Binding Path=F.IsInitOnly}" Value="False">
                                                            <Setter Property="TextBlock.Visibility" Value="Collapsed" />
                                                    </DataTrigger>
                                                </Style.Triggers>
                                            </Style>
                                        </TextBlock.Style></TextBlock>
                                            <TextBlock Text="{Binding Path=F.FieldType.Name}" Foreground="CadetBlue" Margin=" 0,0,5,0" />
                                            <TextBlock Text="{Binding Path= F.DeclaringType.Name}" Margin=" 0,0,0,0" />
                                            <TextBlock Text="." />
                                            <TextBlock Text="{Binding Path=F.Name}" Margin=" 0,0,5,0" />
                                            <TextBox Text="{Binding Path=Значение, Mode=TwoWay}" />
                                        </StackPanel>
                                    </DataTemplate>
                                </ListBox.Resources>
                                <ListBox.ItemContainerStyle>
                                    <Style TargetType="{x:Type ListBoxItem}">
                                        <Setter Property="Background" Value="White" />
                                        <Style.Triggers>
                                            <Trigger Property="IsSelected" Value="True">
                                                <Setter Property="Background" Value="LightSteelBlue" />
                                            </Trigger>
                                        </Style.Triggers>
                                    </Style>
                                </ListBox.ItemContainerStyle>
                                <ListBox.ItemTemplateSelector>
                                    <this:СелекторПоля Нумератор="{StaticResource Перечисление}" Стандартный="{StaticResource Стандартная}" />
                                </ListBox.ItemTemplateSelector>
                                <!--<ListBox.ItemTemplate>
                            
                        </ListBox.ItemTemplate>-->
                            </ListBox>
                        </TabItem>
                        <TabItem Header="Свойства">
                            <ListBox Margin="2" Name="СписокСвойствТипа" ItemsSource="{Binding Path=СвойстваТипа}" MouseDoubleClick="СписокПолей_MouseDoubleClick" IsSynchronizedWithCurrentItem="True">
                                <ListBox.ItemContainerStyle>
                                    <Style TargetType="{x:Type ListBoxItem}">
                                        <Setter Property="Background" Value="White" />
                                        <Style.Triggers>
                                            <Trigger Property="IsSelected" Value="True">
                                                <Setter Property="Background" Value="LightSteelBlue" />
                                                <Setter Property="Foreground" Value="White" />
                                            </Trigger>
                                        </Style.Triggers>
                                    </Style>
                                </ListBox.ItemContainerStyle>
                                <ListBox.ItemTemplate>
                                    <DataTemplate>
                                        <StackPanel Orientation="Horizontal">
                                            <TextBlock Text="{Binding Path= АтрибутыДоступа}" Foreground="Blue" Margin=" 0,0,5,0" />
                                            <TextBlock Text="static" Foreground="Blue" Margin=" 0,0,5,0">
                                        <TextBlock.Style>
                                            <Style> 
                                                <Style.Triggers>
                                                    <DataTrigger Binding="{Binding Path=МетодИнфоСвойства.IsStatic}" Value="False">
                                                            <Setter Property="TextBlock.Visibility" Value="Collapsed" />
                                                    </DataTrigger>
                                                </Style.Triggers>
                                            </Style>
                                        </TextBlock.Style></TextBlock>
                                            <TextBlock Text="{Binding Path=МетодИнфоСвойства.ReturnType.Name}" Foreground="CadetBlue" Margin=" 0,0,0,0" />
                                            <TextBlock Text="{Binding Path= СвойствоИнфо.DeclaringType.Name}" Foreground="CadetBlue" FontWeight="Bold" Margin=" 5,0,0,0" />
                                            <TextBlock Text="." />
                                            <TextBlock Text="{Binding Path=СвойствоИнфо.Name}" Margin=" 0,0,5,0" />
                                            <TextBlock Text="{Binding Path= АтрибутыЧтенияЗаписи}" Foreground="Blue" Margin=" 0,0,5,0" />
                                            <TextBox Text="{Binding Path=Значение, Mode=TwoWay}" />
                                        </StackPanel>
                                    </DataTemplate>
                                </ListBox.ItemTemplate>
                            </ListBox>
                        </TabItem>
                        <TabItem Header="Команды">
                            <ListBox Name="listBoxКомандыТипа" ItemsSource="{Binding Path=МетодыТипа}"></ListBox>
                        </TabItem>
                        <TabItem Header="События" />
                    </TabControl>
                </TabItem>
              
            
                <TabItem  Name="tabItemПоля" Header="Поля" >
                    <TabItem.Style>
                        <Style>
                            <Style.Triggers>
                                <DataTrigger Binding="{Binding Path=ПоляОбъекта.Count}" Value="0">
                                    <Setter Property="TabItem.Visibility" Value="Collapsed" />
                                </DataTrigger>
                            </Style.Triggers>
                        </Style>
                    </TabItem.Style>
                    <TabItem.Resources>
                        <CollectionViewSource x:Key="КоллекцияПоля" Source="{Binding Path=ПоляОбъекта}" 
                                                  Filter="CollectionViewSource_FilterПоля">
                            <CollectionViewSource.GroupDescriptions>
                                <PropertyGroupDescription PropertyName="АтрибутыДоступа"/>
                            </CollectionViewSource.GroupDescriptions>
                        </CollectionViewSource>
                        
                        <ListBox x:Key="ПредсталениеСписок"  Margin="2" Name="СписокПолей"  
                                 MouseDoubleClick="СписокПолей_MouseDoubleClick"
                              ItemsSource="{Binding Source={StaticResource КоллекцияПоля}}">

                            <ListBox.GroupStyle>
                                <GroupStyle>
                                    <GroupStyle.HeaderTemplate>
                                        <DataTemplate>
                                            <TextBlock Text="{Binding Path=Name}" FontWeight="Bold"  />
                                        </DataTemplate>
                                    </GroupStyle.HeaderTemplate>
                                </GroupStyle>
                            </ListBox.GroupStyle>

                            <ListBox.ItemContainerStyle>
                                <Style TargetType="{x:Type ListBoxItem}">
                                    <Setter Property="Background" Value="White" />
                                    <Style.Triggers>
                                        <Trigger Property="IsSelected" Value="true">
                                            <Setter Property="Background" Value="LightSteelBlue" />
                                        </Trigger>
                                    </Style.Triggers>
                                </Style>

                            </ListBox.ItemContainerStyle>
                            <ListBox.ItemTemplate>
                                <DataTemplate >

                                    <StackPanel Orientation="Horizontal" Style="{StaticResource ListBoxItemBack}"  >

                                        <TextBlock Text="{Binding Path= АтрибутыДоступа}" Foreground="Blue" Margin=" 0,0,5,0" />
                                        <TextBlock Text="static"  Foreground="Blue" Margin=" 0,0,5,0" >
                                                        <TextBlock.Style>
                                                                <Style> 
                                                                    <Style.Triggers>
                                                                        <DataTrigger Binding="{Binding Path=F.IsStatic}" Value="False">
                                                                                <Setter Property="TextBlock.Visibility" Value="Collapsed" />
                                                                        </DataTrigger>
                                                                    </Style.Triggers>
                                                                </Style>
                                                            </TextBlock.Style>
                                        </TextBlock>
                                        <TextBlock Text="const"  Foreground="Blue" Margin=" 0,0,5,0" >
                                                    <TextBlock.Style>
                                                        <Style> 
                                                            <Style.Triggers>
                                                                <DataTrigger Binding="{Binding Path=F.IsLiteral}" Value="False">
                                                                        <Setter Property="TextBlock.Visibility" Value="Collapsed" />
                                                                </DataTrigger>
                                                            </Style.Triggers>
                                                        </Style>
                                                    </TextBlock.Style>
                                        </TextBlock>
                                        <TextBlock Text="readonly"  Foreground="Blue" Margin=" 0,0,5,0" >
                                                    <TextBlock.Style>
                                                        <Style> 
                                                            <Style.Triggers>
                                                                <DataTrigger Binding="{Binding Path=F.IsInitOnly}" Value="False">
                                                                        <Setter Property="TextBlock.Visibility" Value="Collapsed" />
                                                                </DataTrigger>
                                                            </Style.Triggers>
                                                        </Style>
                                                    </TextBlock.Style>
                                        </TextBlock>
                                        <TextBlock Text="{Binding Path=ТипПоля}"  Margin=" 0,0,5,0" />
                                        <TextBlock Text="{Binding Path= ИмяТипаОпределившегоПоле}" Margin=" 0,0,0,0" />
                                        <TextBlock Text="." />

                                        <TextBlock Text="{Binding Path=F.Name}" Margin=" 0,0,5,0" />

                                        <ContentPresenter >
                                            <ContentPresenter.ContentTemplateSelector>
                                                <Wpfконфигуратор:СелекторЗначения
                                                 />
                                            </ContentPresenter.ContentTemplateSelector>
                                        </ContentPresenter>
                                    </StackPanel>
                                </DataTemplate>
                            </ListBox.ItemTemplate>

                        </ListBox>

                        <DataGrid x:Key="Таблица" Name="dataGrid1" 
                                  ItemsSource="{Binding Source={StaticResource КоллекцияПоля}}"
                                  AutoGenerateColumns="False" 
                                      HorizontalGridLinesBrush="#FFF0F0F0" VerticalGridLinesBrush="#FFF0F0F0" RowHeaderWidth="20" 
                                      AlternatingRowBackground="AliceBlue" AlternationCount="2"  CanUserResizeRows="False" 
                                      CanUserAddRows="False"
                                      SelectionMode="Single" SelectionUnit="Cell" 
                                      SelectionChanged="dataGrid1_SelectionChanged" 
                                      SelectedCellsChanged="dataGrid1_SelectedCellsChanged" 
                                      MouseDoubleClick="dataGrid1_MouseDoubleClick"
                                       LoadingRow="DataGrid_LoadingRow"       >
                            <DataGrid.Resources>
                                <Wpfконфигуратор:ИндексКонвертер x:Key="ИК" />
                            </DataGrid.Resources>
                            
                            <DataGrid.GroupStyle>
                                <GroupStyle>
                                    <GroupStyle.HeaderTemplate>
                                        <DataTemplate>
                                            <TextBlock Text="{Binding Path=Name}" FontWeight="Bold"  />
                                        </DataTemplate>
                                    </GroupStyle.HeaderTemplate>
                                </GroupStyle>
                            </DataGrid.GroupStyle>
                            
                            <DataGrid.Columns>
                                <DataGridTextColumn Header="Имя Поля" IsReadOnly="True" Binding="{Binding Path=F.Name}" />
                                <DataGridTextColumn Header="Тип поля" IsReadOnly="True" Binding="{Binding Path=ТипПоля}"></DataGridTextColumn>
                                <DataGridTemplateColumn Header="Значение2">
                                    <DataGridTemplateColumn.CellTemplateSelector>
                                        <this:R />
                                    </DataGridTemplateColumn.CellTemplateSelector>
                                    <DataGridTemplateColumn.CellEditingTemplateSelector>
                                        <this:СелекторЗначения />
                                    </DataGridTemplateColumn.CellEditingTemplateSelector>
                                </DataGridTemplateColumn>
                                
                                <DataGridTextColumn Header="Атрибуты Доступа" IsReadOnly="True" Binding="{Binding Path=АтрибутыДоступа}"  />
                                <DataGridTextColumn Header="Определивший Тип" IsReadOnly="True" Binding="{Binding Path= ИмяТипаОпределившегоПоле}"/>
                                <DataGridTextColumn Header="Предок" IsReadOnly="True" Binding="{Binding Path= НомерНаследника}"/>
                                <DataGridTextColumn Header="Значение" Binding="{Binding Path=Значение}" />
                            </DataGrid.Columns>
                        </DataGrid>

                    </TabItem.Resources>
                    
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"></RowDefinition>
                            <RowDefinition></RowDefinition>
                            <RowDefinition Height="100"></RowDefinition>
                        </Grid.RowDefinitions>

                        <Menu  Grid.Row="0" Height="26"  MenuItem.Click="ОбновитьПредставлениеПолей">
                                
                            <MenuItem  Header=" _Фильтры " Height="26" Style="{StaticResource СтильКнопки}" >
                                <MenuItem Name="ФильтрВидимыеПоля" Header="НеВидимые" IsCheckable="True" IsChecked="True" StaysOpenOnClick="True" ToolTip="Убрать недоступные методы" />
                            </MenuItem>
                            <MenuItem Header=" _Вид "  Style="{StaticResource СтильКнопки}" MenuItem.Click="МенюВид_Click" >
                                <MenuItem Name="МенюСписок" Header="Список" Style="{StaticResource СтильКнопки}" />
                                <MenuItem Name="МенюТаблица" Header="Таблица"  />
                            </MenuItem>

                        </Menu>
                        
                        <ContentPresenter Grid.Row="1" Name="ПредсталениеПолей" Content="{StaticResource Таблица}" />

                    </Grid>
                    
                </TabItem>
                
                <TabItem Header="Элементы" >
                	<TabItem.Style>
                        <Style>
                            <Setter Property="TabItem.Visibility" Value="Visible" />
                            <Style.Triggers>
                                <DataTrigger Binding="{Binding Path=ЭтоСписок}" Value="False">
                                    <Setter Property="TabItem.Visibility" Value="Collapsed" />
                                </DataTrigger>
                            </Style.Triggers>
                        </Style>
                    </TabItem.Style>
                    <DataGrid AutoGenerateColumns="False"  Name="dataGridЭлементы" ItemsSource="{Binding Path=Элементы}" 
                                      HorizontalGridLinesBrush="#FFF0F0F0" VerticalGridLinesBrush="#FFF0F0F0" RowHeaderWidth="20" 
                                      AlternatingRowBackground="AliceBlue" AlternationCount="2"  CanUserResizeRows="True" 
                                      CanUserAddRows="True"
                                      SelectionMode="Single" SelectionUnit="Cell" 
                              MouseDoubleClick="dataGridЭлементы_MouseDoubleClick" 
                              CellEditEnding="dataGridЭлементы_CellEditEnding_1" InitializingNewItem="dataGridЭлементы_InitializingNewItem">
                        <DataGrid.Columns>
                            <DataGridTextColumn Header="Индекс" IsReadOnly="True" Binding="{Binding Path=Индекс}" />
                            <DataGridTextColumn Header="Значение" Binding="{Binding Path=Значение}" />
                        </DataGrid.Columns>
                    </DataGrid>

                </TabItem>
                
               
                <!--<TabItem Header="Элементы" >
                            <TabItem.Style>
                                <Style>
                                    <Setter Property="TabItem.Visibility" Value="Collapsed" />
                                    <Style.Triggers>
                                        <DataTrigger Binding="{Binding Path=Тип.IsArray}" Value="true">
                                            <Setter Property="TabItem.Visibility" Value="Collapsed" />
                                        </DataTrigger>
                                    </Style.Triggers>
                                </Style>
                            </TabItem.Style>
                            <ListBox Name="listBoxЭлементы" ItemsSource="{Binding Path=ЭлементыМассива}" 
                                    MouseDoubleClick="СписокПолей_MouseDoubleClick" >
                                <ListBox.ItemTemplate>
                                    <DataTemplate>
                                        <StackPanel Orientation="Horizontal">
                                            <StackPanel.Style>
                                                <Style>
                                                    <Style.Triggers>
                                                        <DataTrigger Binding = "{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type ListBoxItem}}, Path=IsSelected}"
                                                                 Value="True">
                                                            <Setter Property="ListBoxItem.Background" Value="AliceBlue"/>
                                                            <Setter Property="ListBoxItem.Foreground" Value="Black"/>
                                                        </DataTrigger>
                                                    </Style.Triggers>
                                                </Style>
                                            </StackPanel.Style>
                                            <TextBlock Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type ListBox}}, Path=Items/Индекс}" />
                                            <TextBlock Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type ListBoxItem}}, Path=IsSelected}" />
                                            <TextBlock Text="{Binding Path= Индекс}" Margin="3,0,5,0"/>
                                            <TextBox Text="{Binding Path=Значение}"/>
                                        </StackPanel>
                                    </DataTemplate>
                                </ListBox.ItemTemplate>
                            </ListBox>
                        </TabItem>-->

                <TabItem Header="Свойства">

                    <ListBox   Name="СписокСвойств"  ItemsSource="{Binding Path=СвойстваОбъекта}" 
                                        MouseDoubleClick="СписокПолей_MouseDoubleClick" >
                        <ListBox.Resources>
                            <this:ObjectToString x:Key="StringToVisibility" />

                        </ListBox.Resources>

                        <ListBox.ItemTemplate>
                            <DataTemplate  >
                                <StackPanel  Orientation="Horizontal" Style="{StaticResource ListBoxItemBack}">
                                    <TextBlock Text="{Binding Path= АтрибутыДоступа}"  Margin=" 0,0,5,0" />
                                    <TextBlock Text="{Binding Path= АтрибутПерезаписи}" Margin=" 0,0,5,0"
                                                       Visibility="{Binding Path=АтрибутПерезаписи, Converter={StaticResource StringToVisibility}}"/>
                                    <!--<TextBlock Text="static"  Foreground="Blue" Margin=" 0,0,5,0" >
                                                        <TextBlock.Style>
                                                            <Style> 
                                                                <Style.Triggers>
                                                                    <DataTrigger Binding="{Binding Path=МетодИнфоСвойства.IsStatic}" Value="False">
                                                                            <Setter Property="TextBlock.Visibility" Value="Collapsed" />
                                                                    </DataTrigger>
                                                                </Style.Triggers>
                                                            </Style>
                                                        </TextBlock.Style>
                                    </TextBlock>-->

                                    <TextBlock Text="{Binding Path=МетодИнфоСвойства.ReturnType.Name}"  Margin=" 0,0,0,0" />
                                    <TextBlock Text="{Binding Path= МетодИнфоСвойства.DeclaringType.Name}" Margin=" 5,0,0,0" />
                                    <TextBlock Text="." />
                                    <TextBlock Text="{Binding Path=СвойствоИнфо.Name}" Margin=" 0,0,0,0" />
                                    <TextBlock Text="{Binding Path=ПараметрыИндексатора }"  Margin=" 0,0,0,0" />
                                    <TextBlock Text="{Binding Path= АтрибутыЧтенияЗаписи}"  Margin=" 5,0,5,0" />
                                    <ContentPresenter  Margin="20,0,0,0">
                                        <ContentPresenter.ContentTemplateSelector>
                                            <this:СелекторЗначения
                                                />
                                        </ContentPresenter.ContentTemplateSelector>
                                    </ContentPresenter>
                                </StackPanel>
                            </DataTemplate>
                        </ListBox.ItemTemplate>
                    </ListBox>

                </TabItem>
                <TabItem Header="Команды" >
                    <Grid  >
                        <Grid.Resources>
                            
                            <CollectionViewSource x:Key="Методы" Source="{Binding Path=МетодыОбъекта}" 
                                                  Filter="CollectionViewSource_Filter">
                                <CollectionViewSource.GroupDescriptions>
                                    <PropertyGroupDescription PropertyName="АтрибутыДоступа"/>
                                </CollectionViewSource.GroupDescriptions>
                            </CollectionViewSource>
                        </Grid.Resources>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"></RowDefinition>
                            <RowDefinition></RowDefinition>
                            <RowDefinition Height="100"></RowDefinition>
                        </Grid.RowDefinitions>

                        <Menu Grid.Row="0" Height="26">
                                <MenuItem Header="Фильтры" Height="26" Style="{StaticResource СтильКнопки}" MenuItem.Click="ОбновитьПредставлениеМетодов" >
                                    <MenuItem Name="ФильтрСвойств" Header="Свойства" IsCheckable="True" IsChecked="True" StaysOpenOnClick="True"  ToolTip="Убрать методы свойств" />
                                    <MenuItem Name="ФильтрСобытий" Header="События" IsCheckable="True" IsChecked="True" StaysOpenOnClick="True"  ToolTip="Убрать методы событий" />
                                    <MenuItem Name="ФильтрВидимые" Header="НеВидимые" IsCheckable="True" IsChecked="True" StaysOpenOnClick="True" ToolTip="Убрать недоступные методы" />
                                </MenuItem>
                               
                            </Menu>
                            
                           

                        <ListBox  Name="listBoxКомандыОбъекта" Grid.Row="1"  IsTextSearchEnabled="False"
                                  ItemsSource="{Binding Source={StaticResource Методы}}"
                                  IsSynchronizedWithCurrentItem="True" >
                            <ListBox.GroupStyle>
                                <GroupStyle>
                                    <GroupStyle.HeaderTemplate>
                                        <DataTemplate>
                                            <TextBlock Text="{Binding Path=Name}" FontWeight="Bold"  />
                                        </DataTemplate>
                                    </GroupStyle.HeaderTemplate>
                                </GroupStyle>
                            </ListBox.GroupStyle>
                            
                        </ListBox>

                        <TextBlock Grid.Row="2" Text="{Binding Source={StaticResource Методы}, Path=Синтаксис}" TextWrapping="Wrap" />
                    </Grid>



                </TabItem>


                <TabItem  Name="tabItemСобытия" Header="События" >
                    <ListBox  Name="listBoxСобытия" Grid.Row="1" ItemsSource="{Binding Path=События}">
                    </ListBox>
                </TabItem>
            </TabControl>

        </Grid.Children>
        <Grid.Background>
            <LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5">
                <GradientStop Color="#FF004B00" Offset="0.006" />
                <GradientStop Color="White" Offset="1" />
                <GradientStop Color="#FF7FA57F" Offset="0.187" />
            </LinearGradientBrush>
        </Grid.Background>
    </Grid>
</UserControl>
